package com.nine.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nine.common.entity.User;
import com.nine.common.entity.UserInfo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.SelectKey;

import java.util.ArrayList;


/**
 * @Description:
 * @ClassName: UserInfoMapper
 * @Author: luodeng
 * @Date: 2023/6/7 16:57
 * @Version: 1.0
 */
public interface UserInfoMapper extends BaseMapper<UserInfo> {

    @Options(useGeneratedKeys = true, keyProperty = "uid")
    @Insert("INSERT INTO sys_user(username, password, status, role_id) VALUES (#{username}, #{password}, #{status}, #{roleId})")
    @SelectKey(statement = "SELECT LAST_INSERT_ID()", keyProperty = "uid", before = false, resultType = Long.class)
    int insertWithGeneratedId(UserInfo userInfo);


    public ArrayList<String> getPermissions(Long uid);
    public ArrayList<String> getRoles(Long uid);

}
